package com.mastercard.labs

class RedemptionService {

    def serviceMethod() {

    }
	
	def searchByCondition(searchDate, searchStatus){
		log.info 'searchByCondition'
		def result = Redemption.createCriteria().list {
			if(searchDate)
//				eq("rdptDate", searchDate)
				between('rdptDate', DateUtil.parseDate(searchDate, "yyyy-MM-dd"), DateUtil.parseDate(searchDate, "yyyy-MM-dd") + 1)
			if(searchStatus) {
				eq("status", searchStatus)
			}
		}
	}
	
	def redemptionSave(rewardPoint, voucher){
		log.info 'redemptionSave'
		
		rewardPoint.save()
		voucher.save()
		
	}
}
